<?php

/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */



class Carrinho{
    private $listDeItems;
    
    function Carrinho(){
        $this->listDeItems = array();
    }
    
    public function getTotal(){
        $total = 0;
        for ($i=0;$i < $this->countItems();$i++){
            $total = $total + $this->listDeItems[$i]->getProduto->getPreco()*
                    $this->listDeItems[$i]->getQuantidade();
        }
        return $total;
    }
    
    public function countItems(){
        return count($this->listDeItems);
        
    }
}
?>
